package com.aurora.oa.activity;

import java.util.ArrayList;
import java.util.List;

import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

import com.aurora.oa.R;
import com.aurora.oa.adapter.ShowPhotoAdapter;
import com.aurora.oa.customview.HackyViewPager;

/**
 *
 * @author Administrator
 * @文件名 PhotoShowActivity.java
 * @注释 图片详情展示
 * @时间 上午1:37:14
 */
public class PhotoShowActivity extends AppCompatActivity {

    private HackyViewPager viewPager;
    private List<String> list = new ArrayList<String>();
    private TextView photo_size;
    private ImageView back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_photoshow);
        list = (List<String>) getIntent().getStringArrayListExtra("list");
        photo_size = (TextView) findViewById(R.id.photo_size);
        photo_size.setText(1+"/"+list.size());
        back = (ImageView) findViewById(R.id.back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        viewPager = (HackyViewPager) findViewById(R.id.viewPager);
        ShowPhotoAdapter adapter = new ShowPhotoAdapter(list,
                PhotoShowActivity.this);
        viewPager.setAdapter(adapter);
        viewPager.setOnPageChangeListener(new OnPageChangeListener() {

            @Override
            public void onPageSelected(int arg0) {
                photo_size.setText(arg0+1+"/"+list.size());

            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onPageScrollStateChanged(int arg0) {
                // TODO Auto-generated method stub

            }
        });

    }



}
